package com.neusoft.work.dao;

import java.util.List;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.neusoft.work.po.BedInfo;

public interface BedInfoDao extends BaseMapper<BedInfo> {
	
	@Select("select bedNumber from bedInfo where roomNumber=#{roomNumber} and status=1")
	List<String> getBedNumberByRoom(String roomNumber);
	
	@Select("select * from bedInfo where roomNumber = #{roomNumber}")
	List<BedInfo> selectBedsByRoomNumber(String roomNumber);
	
	@Select("select count(*) from bedInfo where roomNumber = #{roomNumber}")
	Integer countBedsByRoomNumber(String roomNumber);
	
	@Select("select count(*) from bedInfo where status = #{status}")
	Integer countBedsByStatus(Integer status);
	
	@Select("SELECT b.* FROM BedInfo b JOIN RoomInfo r ON b.roomNumber = r.roomNumber WHERE r.floor = #{floor}")
	List<BedInfo> selectBedsByFloor(Integer floor);
}
